package gatech.cs2340.adventuretime.persistent;

import gatech.cs2340.adventuretime.persistent.Doctor;
import gatech.cs2340.adventuretime.persistent.Patient;
import gatech.cs2340.adventuretime.persistent.User;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;

/**
 * Roles: Encapsulates Patient-Doctor->Record relationship
 * Responsibility: tracks if the record has been deleted.
 * @author Win Nadeau
 */
// I encapsulated a simple boolean variable into the new *superclass* Record
// so we can keep a little trash bin going. --3/18/11
// 
// Okay now I'm encapsulating the entire relationship between a patient, record, and doctor in this superclass. I had patient and doctor as fields in all of these
// I decided to do this to optimize our db retrievals and updates. I'll provide an updated UML at some point to show the large dependency shift.
// This way we can call "db.store(record) of any type and perform minimal cascading updates.
// All records need to track the relationship between patient-doctor because that's why we have medical records.
// 
public class Record {
	/**
	 * encapsulating the patient-doctor relationship
	 */
	private Patient patient;
	private Doctor doctor;
	
	/**
	 * this variable indicates if the record has been deleted
	 */
	private boolean deleted;
	public Record(Patient patient, Doctor doctor)
	{
		this.patient = patient;
		this.doctor = doctor;
	}
	
	public Record(){
		deleted = false;
	}
	/**
	 * This boolean checker is implemented for our database to have a trash bin, so our queries can avoid deleted records.
	 * set up your trash bin and object queries to include and exclude if(record.isDeleted) respectively.
	 * @returns if the record has been flagged for deletion 
	 */
	public boolean isDeleted()
	{
		return deleted;
	}
	public void delete()
	{
		this.deleted = true;
	}
}
